﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
namespace Soket_MMTNC_Server
{
    [Serializable]
    class Serializable:ISerializable
    {
        Product pro = new Product();
        //Serializable
        public void GetObjectData(SerializationInfo info, StreamingContext strctx)
        {
            info.AddValue("ID", pro.ProductID);
            info.AddValue("ProductName", pro.ProductName);
            info.AddValue("UnitPrice", pro.UnitPrice);
            info.AddValue("Price", pro.Price);
        }
        //DeSerializable
        public void DeSerializable(SerializationInfo info, StreamingContext strctx)
        {
            pro.ProductID = (int)info.GetValue("ID",typeof(int));
            pro.Price = (string)info.GetValue("Price", typeof(string));
            pro.UnitPrice = (string)info.GetValue("UnitPrice", typeof(string));
            pro.ProductName = (string)info.GetValue("ProductName", typeof(string));
        }
    }
}
